// pages/tax/tax.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    fresh:false,
    showMonth:false,
    userInFot:{},
    topTabs: [{
        id: '10',
        text: '工资固定',
        styles:'',
        selected: true
      },
      {
        id: '20',
        text: '每月浮动',
        styles:'',
        selected: false
      }
    ],
    bottomTabs: [{
      id: '10',
      text: '算税',
      styles:'keyboard',
      color:'rgba(247, 173, 76, 1)',
      selected: true
    },
    {
      id: '20',
      text: '我的',
      styles:'me',
      color:'',
      selected: false
    }
  ]
  },
  setUserInfo:function(e){
    // console.log(JSON.parse(e.detail.userInFo));
    this.setData({
      userInFot:e.detail.userInFo
    });
    this.setData({
      fresh:true
    })
},
  selectedTap:function(e){
    // this.data.tabs.map(function(ev){
    //   ev.selected = false;
    //   if(ev.id === e.detail.tabSlect){
    //     ev.selected = true;
    //   }
    //   return ev;
    // });
    if(e.currentTarget.id === 'top'){
      for(var i = 0;i < this.data.topTabs.length;i++){
        var temp = "topTabs["+i+"].selected";
        if(this.data.topTabs[i].id === e.detail.tabSlect){
          this.setData({
            [temp]:true
          });
        }else{
          this.setData({
            [temp]:false
          });
        }
      }
    }else if(e.currentTarget.id === 'bottom'){
      for(var i = 0;i < this.data.bottomTabs.length;i++){
        var temp = "bottomTabs["+i+"].selected",color = "bottomTabs["+i+"].color";
        if(this.data.bottomTabs[i].id === e.detail.tabSlect){
          this.setData({
            [temp]:true,
            [color]:'rgba(247, 173, 76, 1)'
          });
        }else{
          this.setData({
            [temp]:false,
            [color]:''
          });
        }
      }
    }
  }
})